package com.example.voucher.contract.spi;

import java.math.BigDecimal;
import java.util.Date;

import com.example.voucher.contract.VoucherItemAccessor;
import com.example.voucher.contract.VoucherItemCapable;
import com.example.voucher.enums.VoucherScenarioEnum;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@NoArgsConstructor
public class DefaultVoucherItemAccessor implements VoucherItemAccessor {

    public DefaultVoucherItemAccessor(VoucherItemCapable item) {
        this.setScenario(item.getScenario());
        this.setOrgTitleCode(item.getOrgTitleCode());
        this.setOrgTitleName(item.getOrgTitleName());
        this.setOrgTitleFullname(item.getOrgTitleFullname());
        this.setOppoOrgTitleCode(item.getOppoOrgTitleCode());
        this.setOppoOrgTitleName(item.getOppoOrgTitleName());
        this.setOppoOrgTitleFullname(item.getOppoOrgTitleFullname());
        this.setInvoiceCode(item.getInvoiceCode());
        this.setInvoiceNo(item.getInvoiceNo());
        this.setInvoiceDate(item.getInvoiceDate());
        this.setInvoiceId(item.getInvoiceId());
        this.setInvoiceSn(item.getInvoiceSn());
        this.setInvoiceSnId(item.getInvoiceSnId());
        this.setWeight(item.getWeight());
        this.setPreTaxAmount(item.getPreTaxAmount());
        this.setTaxAmount(item.getTaxAmount());
        this.setPriceTaxAmount(item.getPriceTaxAmount());
        this.setOrderCode(item.getOrderCode());
        this.setOrderDate(item.getOrderDate());
        this.setRcCode(item.getRcCode());
        this.setRcName(item.getRcName());
        this.setProductLine(item.getProductLine());
        this.setSiteCode(item.getSiteCode());
        this.setSiteName(item.getSiteName());
        this.setSiteFullname(item.getSiteFullname());
        this.setNow(item.getNow());
        this.setScanDate(item.getScanDate());
        this.setVerifyDate(item.getVerifyDate());
        this.setAccountDate(item.getAccountDate());
        this.setUnit(item.getUnit());
        this.setItName(item.getItName());
        this.setIcName(item.getIcName());
        this.setQtyUnit(item.getQtyUnit());
    }

    /**
     * 场景编号
     * 
     * @see VoucherScenarioEnum
     */
    private String scenario;

    // 本方公司
    private String orgTitleCode;
    private String orgTitleName;
    private String orgTitleFullname;

    // 相对方
    private String oppoOrgTitleCode;
    private String oppoOrgTitleName;
    private String oppoOrgTitleFullname;

    // 发票
    private String invoiceCode;
    private String invoiceNo;
    private Date now; // 当前时间
    private Date scanDate; // 发票扫描时间
    private Date invoiceDate; // 发票打印时间
    private Date accountDate; // 记账日期
    private Date verifyDate; // 核销日期
    private Long invoiceId;
    private Integer invoiceSn;
    private Long invoiceSnId;

    /**
     * 数量字段
     */
    private BigDecimal weight;
    private String unit;
    private String qtyUnit;
    private BigDecimal preTaxAmount;
    private BigDecimal taxAmount;
    private BigDecimal priceTaxAmount;

    private String orderCode;
    private Date orderDate; // 订单日期
    private String rcCode;
    private String rcName;
    private String productLine;
    private String siteCode;
    private String siteName;
    private String siteFullname;

    /**
     * 品名
     */
    private String itName;
    /**
     * 品类
     */
    private String icName;

    /**
     * 需要二次汇总的字段
     */
    private BigDecimal totalWeight;
    private BigDecimal totalPreTaxAmount;
    private BigDecimal totalTaxAmount;
    private BigDecimal totalPriceTaxAmount;

    private String firstItName;
    private String firstInvoiceNo;
    private Date firstInvoiceDate;

    private String entryQtyUnit;
    private String entryOrderCode;
    private String entryInvoiceNo;

    private String asstOrderCode;
    private String asstInvoiceNo;

}
